/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * BuscarEditar_asesor.java
 *
 * Created on Jul 21, 2011, 4:28:21 PM
 */
package Asesor;
import callProcs.ProcsAsesores;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Juls
 */
public class BuscarEditar_asesor extends javax.swing.JFrame {

    /** Creates new form BuscarEditar_asesor */
    String idAsesor=null;
    String NA, AA, TA,EA, ActivoA;
     ProcsAsesores VerAsesor =new ProcsAsesores();
        java.sql.ResultSet rs,rs2;
    public BuscarEditar_asesor() {
        initComponents();
       
        NombresAsesor_ByE.setEnabled(false);    
        ApellidosAsesor_ByE.setEnabled(false);
        TelefonoAsesor_ByE.setEnabled(false);
        EmailAsesor_ByE.setEnabled(false);
        jLabel3.setEnabled(false);
        jLabel4.setEnabled(false);
        jLabel5.setEnabled(false);
        jLabel6.setEnabled(false);
        jLabel7.setEnabled(false);
        GuardAsesor_ByE.setVisible(false);

        EditarAsesor_ByE.setVisible(false);
        Activocheck_ByE.setEnabled(false);
        Inactivocheck_ByE.setEnabled(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        ComboAsesores = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        EditarAsesor_ByE = new javax.swing.JButton();
        GuardAsesor_ByE = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        NombresAsesor_ByE = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        ApellidosAsesor_ByE = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        TelefonoAsesor_ByE = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        EmailAsesor_ByE = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        Activocheck_ByE = new javax.swing.JRadioButton();
        Inactivocheck_ByE = new javax.swing.JRadioButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(bufete.BufeteApp.class).getContext().getResourceMap(BuscarEditar_asesor.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N
        setResizable(false);

        ComboAsesores.setName("ComboAsesores"); // NOI18N
        ComboAsesores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ComboAsesoresActionPerformed(evt);
            }
        });

        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        EditarAsesor_ByE.setIcon(resourceMap.getIcon("EditarAsesor_ByE.icon")); // NOI18N
        EditarAsesor_ByE.setText(resourceMap.getString("EditarAsesor_ByE.text")); // NOI18N
        EditarAsesor_ByE.setToolTipText(resourceMap.getString("EditarAsesor_ByE.toolTipText")); // NOI18N
        EditarAsesor_ByE.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        EditarAsesor_ByE.setName("EditarAsesor_ByE"); // NOI18N
        EditarAsesor_ByE.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                EditarAsesor_ByEMouseClicked(evt);
            }
        });
        EditarAsesor_ByE.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EditarAsesor_ByEActionPerformed(evt);
            }
        });

        GuardAsesor_ByE.setIcon(resourceMap.getIcon("GuardAsesor_ByE.icon")); // NOI18N
        GuardAsesor_ByE.setText(resourceMap.getString("GuardAsesor_ByE.text")); // NOI18N
        GuardAsesor_ByE.setToolTipText(resourceMap.getString("GuardAsesor_ByE.toolTipText")); // NOI18N
        GuardAsesor_ByE.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        GuardAsesor_ByE.setName("GuardAsesor_ByE"); // NOI18N
        GuardAsesor_ByE.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                GuardAsesor_ByEActionPerformed(evt);
            }
        });

        jLabel8.setIcon(resourceMap.getIcon("jLabel8.icon")); // NOI18N
        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jTextField1.setText(resourceMap.getString("jTextField1.text")); // NOI18N
        jTextField1.setName("jTextField1"); // NOI18N
        jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextField1KeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTextField1KeyReleased(evt);
            }
        });

        jLabel9.setFont(resourceMap.getFont("jLabel9.font")); // NOI18N
        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jPanel1.setName("jPanel1"); // NOI18N

        jLabel3.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        NombresAsesor_ByE.setText(resourceMap.getString("NombresAsesor_ByE.text")); // NOI18N
        NombresAsesor_ByE.setName("NombresAsesor_ByE"); // NOI18N
        NombresAsesor_ByE.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                NombresAsesor_ByEKeyTyped(evt);
            }
        });

        jLabel4.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        ApellidosAsesor_ByE.setText(resourceMap.getString("ApellidosAsesor_ByE.text")); // NOI18N
        ApellidosAsesor_ByE.setName("ApellidosAsesor_ByE"); // NOI18N
        ApellidosAsesor_ByE.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ApellidosAsesor_ByEKeyTyped(evt);
            }
        });

        jLabel5.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        TelefonoAsesor_ByE.setText(resourceMap.getString("TelefonoAsesor_ByE.text")); // NOI18N
        TelefonoAsesor_ByE.setName("TelefonoAsesor_ByE"); // NOI18N
        TelefonoAsesor_ByE.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                TelefonoAsesor_ByEKeyTyped(evt);
            }
        });

        jLabel6.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        EmailAsesor_ByE.setText(resourceMap.getString("EmailAsesor_ByE.text")); // NOI18N
        EmailAsesor_ByE.setName("EmailAsesor_ByE"); // NOI18N

        jLabel7.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        Activocheck_ByE.setText(resourceMap.getString("Activocheck_ByE.text")); // NOI18N
        Activocheck_ByE.setName("Activocheck_ByE"); // NOI18N
        Activocheck_ByE.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                Activocheck_ByEMouseClicked(evt);
            }
        });

        Inactivocheck_ByE.setText(resourceMap.getString("Inactivocheck_ByE.text")); // NOI18N
        Inactivocheck_ByE.setName("Inactivocheck_ByE"); // NOI18N
        Inactivocheck_ByE.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                Inactivocheck_ByEMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel4)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(ApellidosAsesor_ByE))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel3)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(NombresAsesor_ByE, javax.swing.GroupLayout.PREFERRED_SIZE, 333, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel6)
                            .addComponent(jLabel7))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(29, 29, 29)
                                .addComponent(Activocheck_ByE)
                                .addGap(47, 47, 47)
                                .addComponent(Inactivocheck_ByE))
                            .addComponent(TelefonoAsesor_ByE, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(EmailAsesor_ByE, javax.swing.GroupLayout.PREFERRED_SIZE, 276, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(200, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(NombresAsesor_ByE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(ApellidosAsesor_ByE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(TelefonoAsesor_ByE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(EmailAsesor_ByE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(Activocheck_ByE)
                    .addComponent(Inactivocheck_ByE))
                .addContainerGap(27, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addGap(71, 71, 71)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(ComboAsesores, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextField1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE))
                        .addGap(27, 27, 27)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 266, Short.MAX_VALUE)
                        .addComponent(EditarAsesor_ByE, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(GuardAsesor_ByE, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(53, 53, 53))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(31, 31, 31)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(229, 229, 229)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(ComboAsesores, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(69, 69, 69)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(77, 77, 77)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(EditarAsesor_ByE, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(GuardAsesor_ByE, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel8))
                .addGap(24, 24, 24))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void EditarAsesor_ByEMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_EditarAsesor_ByEMouseClicked
        // TODO add your handling code here:
        //verificacion
        NombresAsesor_ByE.setEnabled(true);    
        ApellidosAsesor_ByE.setEnabled(true);
        TelefonoAsesor_ByE.setEnabled(true);
        EmailAsesor_ByE.setEnabled(true);
        jLabel3.setEnabled(true);
        jLabel4.setEnabled(true);
        jLabel5.setEnabled(true);
        jLabel6.setEnabled(true);
        jLabel7.setEnabled(false);
        GuardAsesor_ByE.setVisible(true);

        EditarAsesor_ByE.setVisible(false);
        Activocheck_ByE.setEnabled(true);
        Inactivocheck_ByE.setEnabled(true);
        
        
        
    }//GEN-LAST:event_EditarAsesor_ByEMouseClicked

    private void Activocheck_ByEMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Activocheck_ByEMouseClicked
        // TODO add your handling code here:
        if(Activocheck_ByE.isSelected()==true)
        {
            Inactivocheck_ByE.setSelected(false);
        }
        
        
    }//GEN-LAST:event_Activocheck_ByEMouseClicked

    private void Inactivocheck_ByEMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Inactivocheck_ByEMouseClicked
        // TODO add your handling code here:
       if(Inactivocheck_ByE.isSelected()==true)
        {
            Activocheck_ByE.setSelected(false);
        }
    }//GEN-LAST:event_Inactivocheck_ByEMouseClicked

    private void ComboAsesoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ComboAsesoresActionPerformed
        // TODO add your handling code here:
      
        //jTextField1.setText(ComboAsesores.getSelectedItem().toString());      
    }//GEN-LAST:event_ComboAsesoresActionPerformed

    private void NombresAsesor_ByEKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_NombresAsesor_ByEKeyTyped
        // TODO add your handling code here:
         char caracter = evt.getKeyChar();
         if(((Character.isDigit(caracter)== true && caracter!= evt.VK_BACK_SPACE)))
      {
         evt.consume();  // ignorar el evento de teclado
      }  
    }//GEN-LAST:event_NombresAsesor_ByEKeyTyped

    private void ApellidosAsesor_ByEKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ApellidosAsesor_ByEKeyTyped
        // TODO add your handling code here:
         char caracter = evt.getKeyChar();
         if(((Character.isDigit(caracter)== true && caracter!= evt.VK_BACK_SPACE)))
      {
         evt.consume();  // ignorar el evento de teclado
      }  
    }//GEN-LAST:event_ApellidosAsesor_ByEKeyTyped

    private void TelefonoAsesor_ByEKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TelefonoAsesor_ByEKeyTyped
        // TODO add your handling code here:
         char caracter = evt.getKeyChar();
         if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE))||TelefonoAsesor_ByE.getText().length() >= 8)
      {
         evt.consume();  // ignorar el evento de teclado
      }  
    }//GEN-LAST:event_TelefonoAsesor_ByEKeyTyped

    private void GuardAsesor_ByEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_GuardAsesor_ByEActionPerformed
        // TODO add your handling code here:
              
       if ((NombresAsesor_ByE.getText().equals(""))|| (ApellidosAsesor_ByE.getText().equals(""))||(TelefonoAsesor_ByE.getText().equals(""))||(EmailAsesor_ByE.getText().equals(""))||(Activocheck_ByE.isSelected()==false)&&(Inactivocheck_ByE.isSelected()==false))
          {
              JOptionPane.showMessageDialog(null, "Debe ingresar todos los campos", "Campo Obligatorio", JOptionPane.WARNING_MESSAGE);   
           
          } 
         else
         { 
          ProcsAsesores ActAs = new ProcsAsesores();
            if (Activocheck_ByE.isSelected()==true)
             {
                 ActAs.ActualizarAsesor(idAsesor, NombresAsesor_ByE.getText(),ApellidosAsesor_ByE.getText(),TelefonoAsesor_ByE.getText(),EmailAsesor_ByE.getText(),"True");
             }
            if (Inactivocheck_ByE.isSelected()==true)
             {
                 ActAs.ActualizarAsesor(idAsesor, NombresAsesor_ByE.getText(),ApellidosAsesor_ByE.getText(),TelefonoAsesor_ByE.getText(),EmailAsesor_ByE.getText(),"False");
             }
           
            if(JOptionPane.showConfirmDialog(null, "Asesor Ingresado Exitosamente. ¿Desea Editar un Nuevo Asesor?" , "Edición Correcto", JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION)
             {
                NombresAsesor_ByE.setText("");    
                ApellidosAsesor_ByE.setText("");
                TelefonoAsesor_ByE.setText("");
                EmailAsesor_ByE.setText("");
                NombresAsesor_ByE.setEnabled(false);    
                ApellidosAsesor_ByE.setEnabled(false);
                TelefonoAsesor_ByE.setEnabled(false);
                EmailAsesor_ByE.setEnabled(false);
                jLabel3.setEnabled(false);
                jLabel4.setEnabled(false);
                jLabel5.setEnabled(false);
                jLabel6.setEnabled(false);
                jLabel7.setEnabled(false);

                EditarAsesor_ByE.setEnabled(true);
                GuardAsesor_ByE.setVisible(false);
                Activocheck_ByE.setSelected(false);
                Inactivocheck_ByE.setSelected(false);
                Activocheck_ByE.setEnabled(false);
                Inactivocheck_ByE.setEnabled(false);
             }
            else
            {
               this.dispose();
            }               
             
             
        }        
    }//GEN-LAST:event_GuardAsesor_ByEActionPerformed

    private void EditarAsesor_ByEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditarAsesor_ByEActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_EditarAsesor_ByEActionPerformed

    private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyReleased
        // TODO add your handling code here:     
    }//GEN-LAST:event_jTextField1KeyReleased

    private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyPressed
        // TODO add your handling code here:
        ComboAsesores.removeAllItems();
       // JOptionPane.showMessageDialog(null, jTextField5.getText());
        try {
           rs= VerAsesor.verAsesores(jTextField1.getText());
            while (rs.next()){
                ComboAsesores.addItem(rs.getObject("nombrec"));
            }
        } catch (SQLException ex) {
            Logger.getLogger(BuscarEditar_asesor.class.getName()).log(Level.SEVERE, null, ex);
        } 
    }//GEN-LAST:event_jTextField1KeyPressed

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
        // TODO add your handling code here:
       EditarAsesor_ByE.setVisible(true);  
    }//GEN-LAST:event_jButton1MouseClicked

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
       
         
        try {
            rs2= VerAsesor.verAsesores(ComboAsesores.getSelectedItem().toString());
            while (rs2.next()){
            idAsesor = rs2.getObject("idAsesor").toString();
            NA=rs2.getObject("Nombre_asesor").toString();
            NombresAsesor_ByE.setText(NA);    
            AA=rs2.getObject("Apellido_asesor").toString();
            ApellidosAsesor_ByE.setText(AA);
            TA=rs2.getObject("Telefono_asesor").toString();
            TelefonoAsesor_ByE.setText(TA);
            EA=rs2.getObject("email_asesor").toString();
            EmailAsesor_ByE.setText(EA);
            ActivoA=rs2.getObject("en_activo").toString();
            if (ActivoA.equals("true"))
            {
                 Activocheck_ByE.setSelected(true);
            }
            else
            {
               Inactivocheck_ByE.setSelected(true); 
            } 
        }
            
        } catch (SQLException ex) {
            Logger.getLogger(BuscarEditar_asesor.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new BuscarEditar_asesor().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JRadioButton Activocheck_ByE;
    private javax.swing.JTextField ApellidosAsesor_ByE;
    private javax.swing.JComboBox ComboAsesores;
    private javax.swing.JButton EditarAsesor_ByE;
    private javax.swing.JTextField EmailAsesor_ByE;
    private javax.swing.JButton GuardAsesor_ByE;
    private javax.swing.JRadioButton Inactivocheck_ByE;
    private javax.swing.JTextField NombresAsesor_ByE;
    private javax.swing.JTextField TelefonoAsesor_ByE;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration//GEN-END:variables
}
